#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
void as(int n, char x, char y, char z)
{
	if (n == 0)
		return;
	as(n - 1, x, z, y);
	printf("%c->%d->%c\n", x, n, z);
	as(n - 1, y, x, z);

}
int main()
{
	int n;
	char a, b, c;
	cin >> n >> a >> b >> c;
	as(n, a, c, b);
	return 0;
}